package com.gambi.tapestry.components.gwtui;

import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.RequestParameter;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.ComponentSource;
import org.apache.tapestry5.services.PageRenderLinkSource;

import com.gambi.tapestry.client.GWTUI;
import com.gambi.tapestry.components.GWTComponent;
import com.gambi.tapestry.utils.GWTConstant;
import com.trsvax.tapestry.gwt.annotation.GWT;

@GWT(entryPoint = GWTUI.class, entryPointName = "com.gambi.example.gwtUI", componentType = "CheckBox")
public class CheckBox extends GWTComponent {

	@GWT
	@Property
	@Parameter(defaultPrefix = "literal")
	private String div = "result";

	@Inject
	private ComponentResources componentResources;

	@Property
	private Boolean value;

	@Inject
	private ComponentSource componentSource;

	@Inject
	private PageRenderLinkSource pageRenderLinkSource;

	@Log
	@GWT(bubbling = false)
	public void onChange(
			@RequestParameter(GWTConstant.GWT_REQUEST_PARAMETER_ABSOLUTE_PREFIX
					+ "0") Boolean value) {
		System.out
				.println("@RequestParameter(GWTConstant.GWT_REQUEST_PARAMETER_ABSOLUTE_PREFIX + \"0\") Boolean "
						+ value);
	}

}
